<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../common/commonInclude.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<title><%=SYSTEM_NAME%></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="overview & stats" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- basic styles -->
<link href="<%=basePath%>resource/assets/css/bootstrap.min.css"
	rel="stylesheet" />
<link
	href="<%=basePath%>resource/assets/css/bootstrap-responsive.min.css"
	rel="stylesheet" />
<link rel="stylesheet"
	href="<%=basePath%>resource/assets/css/font-awesome.min.css" />
<!--[if IE 7]>
		  <link rel="stylesheet" href="<%=basePath%>resource/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
<!-- ace styles -->
<link rel="stylesheet"
	href="<%=basePath%>resource/assets/css/ace.min.css" />
<link rel="stylesheet"
	href="<%=basePath%>resource/assets/css/ace-responsive.min.css" />
<link rel="stylesheet"
	href="<%=basePath%>resource/assets/css/ace-skins.min.css" />
<!--[if lt IE 9]>
		  <link rel="stylesheet" href="<%=basePath%>resource/assets/css/ace-ie.min.css" />
		<![endif]-->

</head>
<body>
	<div class="container-fluid" id="main-container">
		<div class="table-header">
			<div class="toolbar">
				<div class="operations" style="display:inline">
					<button id="saveNewPassword" style="text-align: center" class="btn btn-info btn-mini">保存</button>
				</div>
				&nbsp;&nbsp;&nbsp;&nbsp;密码重置
			</div>
		</div>
		<div id="page-content" class="clearfix">
			<form id="vform">
			<div  class="row-fluid form-horizontal">
				<div class="span6 control-group">
					<label class="control-label" style="">请输入新密码</label>
					<div class="controls">
						<input type="password" id="newpwd" name="newpwd" placeholder="Account Password"
						  check-type="required minlength" minlength-rule="6" 
						  required-message="请输入新密码" minlength-message="需要大于6个字符" 
						  formParam="formParam" />
					</div>
				</div>
				
				<div class="span6 control-group">
					<label class="control-label" style="">请再次输入新密码</label>
					<div class="controls">
						<input type="password" id="renewpwd" name="renewpwd" placeholder="Account Password"
						  check-type="required" required-message="请再次输入新密码"
						  formParam="formParam" />
					</div>
				</div>
			</div>
			</form>
		</div>
	</div>

		<!-- basic scripts -->
		<script src="<%=basePath%>resource/jquery/jquery-1.9.1.min.js"></script>
		<script type="text/javascript">
		window.jQuery || document.write("<script src='<%=basePath%>resource/jquery/jquery-1.9.1.min.js'>\x3C/script>");
		</script>
		<script src="<%=basePath%>resource/jquery/jquery-migrate-1.2.1.min.js"></script>
		<script src="<%=basePath%>resource/assets/js/bootstrap.min.js"></script>
		<!-- page specific plugin scripts -->

		<!--[if lt IE 9]>
		<script type="text/javascript" src="<%=basePath%>resource/assets/js/excanvas.min.js"></script>
		<![endif]-->
		<script type="text/javascript"
			src="<%=basePath%>resource/assets/js/jquery-ui-1.10.2.custom.min.js"></script>
		<!-- page specific plugin scripts -->
		<!-- ace scripts -->
		<script src="<%=basePath%>resource/assets/js/ace-elements.min.js"></script>
		<script src="<%=basePath%>resource/assets/js/ace.min.js"></script>
		<script src="<%=basePath%>resource/assets/js/jquery.validate.min.js"></script>
		<script src="<%=basePath%>resource/util/demonutil.js"></script>

		<!-- inline scripts related to this page -->

		<script type="text/javascript">
			$(function() {
				
				$.demonPlugin.formValidate("vform");
				
				$("#saveNewPassword").click(function(){
					var newpwd = $("#newpwd").val();
					var renewpwd = $("#renewpwd").val();
					if (!$("form").valid()){
						return false;
					} else if (newpwd!=renewpwd){
						alert("密码不匹配");
						return false;
					}
					var params = location.href.split("?");
					params = params.length>1?params[1]:"";
					var data = {"newpwd": newpwd, "params":params, "refer": "${it.ref}"};
					$.demonPlugin.asyncData("POST", "renewpwd", data, function(data){
						if (data.status == "ok"){
							alert("修改成功");
							window.close();
						}else {
							alert("修改失败，请重试");
						}
					}, function(data){
						alert("保存失败，请重试");
					}, {"userid":"userid"});
					return false;
				});
			})
		</script>
</body>
</html>
